/**
 * @description  : 服务-页签组件
 * @descriptionDetail : 服务-页签组件
 * @copyright    : 浙江烟草
 * @author       : dw
 * @create       : 2022-12-05 10:16:26
 */
<template>
  <view style="height:100%;">
    <view style="height:100%;" class="top-lay">
      <view class="retail">
        <fsection :title="title.basemsg" class="pl-16"></fsection>
        <u-gap :height="$theme.cm_section_top_gap_height" :bg-color="$theme.cm_gap_color"></u-gap>
      </view>
      <view class="rdcontent">
        <u-row gutter="16" align="top" class="rowbor">
          <u-col span="6">
            <view class="msg-title">
              送货员姓名
            </view>
            <view class="msg-context">
              {{ basemsg.agentName || "/" }}
            </view>
          </u-col>
          <u-col span="6">
            <view class="msg-title">
              订货周期
            </view>
            <view class="msg-context">
              {{ $u.dic.getDicNameByKeyCode($u.dic.DIC_KEYS.L_ORDER_CYCLE_TYPE,licenseInfoExternal.orderCycleType) || '/' }}
            </view>
          </u-col>
        </u-row>
        <u-row gutter="16" justify="space-between" align="top" class="rowbor">
          <u-col span="6">
            <view class="msg-title">
              送货方式
            </view>
            <view class="msg-context">
              {{ $u.dic.getDicNameByKeyCode($u.dic.DIC_KEYS.L_DELIVER_TYPE,otherLicenseDetail.deliverType) || '/' }}
            </view>
          </u-col>
          <u-col span="6">
            <view class="msg-title">
              送货周期
            </view>
            <view class="msg-context">
              {{ $u.dic.getDicNameByKeyCode($u.dic.DIC_KEYS.L_DELIVER_PERIOD,otherLicenseDetail.deliverPeriod) || '/' }}
            </view>
          </u-col>
        </u-row>
        <u-row gutter="16" justify="space-between" align="top" class="rowbor">
          <u-col span="6">
            <view class="msg-title">
              专卖管理员姓名
            </view>
            <view class="msg-context">
              {{ otherLicenseDetail.principalName || "/" }}
            </view>
          </u-col>
          <u-col span="6">
            <view class="msg-title">
              客户经理姓名
            </view>
            <view class="msg-context">
              {{ licenseInfoExternal.custManager|| "/" }}
            </view>
          </u-col>
        </u-row>
        <u-row gutter="16" align="top" class="rowbor">
          <u-col span="6">
            <view class="msg-title">
              所属片区
            </view>
            <view class="msg-context">
              {{ basemsg.orgName || "/" }}
            </view>
          </u-col>
          <u-col span="6">
            <view class="msg-title">
              客户分类
            </view>
            <view class="msg-context">
              {{ licenseInfoExternal.custTypeName || "/" }}
            </view>
          </u-col>
        </u-row>
        <u-row gutter="16" align="top" class="rowbor">
          <u-col span="12">
            <view class="msg-title">
              所属营销路线
            </view>
            <view class="msg-context">
              {{ licenseInfoExternal.salerDeptName || "/" }}
            </view>
          </u-col>
        </u-row>
        <u-row gutter="16" align="top" class="rowbor">
          <u-col span="12">
            <view class="msg-title">
              所属送货路线
            </view>
            <view class="msg-context">
              {{ licenseInfoExternal.deliverDeptName || "/" }}
            </view>
          </u-col>
        </u-row>
      </view>
      <view class="retail">
        <u-gap :height="$theme.cm_section_top_gap_height" :bg-color="$theme.cm_gap_color"></u-gap>
        <fsection :title="title.record" class="pl-16"></fsection>
      </view>
    </view>
    <view class="ordermsg">
      <me-list
        :i="22"
        :index="22"
        :loadData="myLoadData"
        :normalScrollView="true"
        ref="mescrollItem"
        :height="listHeight"
      >
        <template slot-scope="d">
          <orderRecord :recordgoods="d.data"></orderRecord>
        </template>
      </me-list>
    </view>
  </view>
</template>

<script>
import fsection from "@/components/form-section.vue";
import MescrollList from "@/components/mescroll_list.vue";
import certificateService from "@/service/certificate/certificate.service.js";
import orderRecord from "./componets/orderRecord.vue";
export default {
  components:{
    fsection,orderRecord, "me-list":MescrollList,
  },
  props:['basemsg','otherLicenseDetail','licenseInfoExternal',],
  data(){
    return{
      title:{
        basemsg:"服务信息",
        record:"进货记录",
      },
      show:false,
      date:"",
      endDate:"",
      startDate:"",
      listHeight: "400px",
    }
  },
  created(){
  },
  methods:{
    initView(){
      let self = this;
      this.$u.getRect(".top-lay").then(rect => {
        console.log(rect);
        self.listHeight = (self.$u.sys().windowHeight - self.$u.sys().statusBarHeight - uni.upx2px(104) - uni.upx2px(120) - rect.height) + 'px';
      })
    },
    myLoadData(page){
      let self = this;
      let param = {
        page: page.num,
        limit: page.size,
        licenseNo: this.basemsg.licNo,
        defaultPageSize: 10,
      }
      return new Promise(resolve => {
        certificateService.findOrderList(param).then(res => {
          if(res.success){
            let arr = res.data;
            resolve({ data:  arr, totalCount : res.count,});
          }else{
            self.$modal.alert(res.msg);
            resolve({ data:  [], totalCount : 0,});
          }
        }).catch(err => {
          self.$modal.alert(err);
          resolve({ data:  [], totalCount : 0,});
        });
      });
    },
    change(e){
      this.date = e.startDate + "至" + e.endDate;
      this.startDate = e.startDate;
      this.endDate = e.endDate;
      this.$refs.mescrollItem.refresh()
    },
  },

}
</script>

<style lang="scss" scoped>
@import "./retailItem.scss";
.ordermsg{
  position: relative;
  padding: 0rpx 28rpx 10rpx 28rpx;
  margin:10rpx 0rpx;
  background-color: #fff;
}
.stock{
  padding:20rpx 0rpx;
  font-size: $cm_form_item_label_font_size;
}
</style>
